var events= require("events");
var emitter = new events.EventEmitter();


emitter.on('greet',function () {
    console.log("greeting...")
})


/**
 *   同步 ： 顺序执行
 *   异步： 跳步执行
 *     step1
 *     step2 --- 异步 ---- doing
 *     step3
 * */

var sayHello = function(){
    setTimeout(function () {
        emitter.emit('greet');
        console.log('hello finished!');
    },2000)
}

module.exports = {
    sayHello
}